#pragma once
#include <tweeny/tweeny.h>

class CAnimator {
public:
    enum { During = 100 };

    CAnimator() {
        /* Creates the tweening. By default tweenings use a linear easing */
        auto t = tweeny::from(0).to(100).during(During).onStep(CAnimator::print);
        test(t, tweeny::easing::linear);
    }
    
private:
    /* Set the easing, seek to beginning, loop until 100 */
    template<typename EasingT>
    void test(tweeny::tween<int> & tween, EasingT easing) {
        tween.via(0, easing);
        tween.seek(0);
        for (int i = 0; i <= During; i++)
            tween.step(1.0f / During);
    }

    /* Prints a line, showing the tween value and a dot corresponding to that value */
    static bool print(tweeny::tween<int> &, int p) {
        printf("%+.3d |", p); // 3 digits with sign
        for (int i = 0; i <= 100; i++) printf("%c", i == p ? '.' : ' '); // prints the line
        printf("%c\n", p == 100 ? ';' : '|');
        return false;
    }
};